#-*- coding: utf-8 -*-
from mypy import now, sleep,tryx, argv,argc

#https://github.com/Pithikos/websocket-client
#pip3 install websocket-client

from mypy import wsc,sys

port = int(argv[1])
host = argv[2] if argc>2 else '127.0.0.1'
address = f'ws://{host}:{port}/'
print(address)

for line in sys.stdin: print(tryx(lambda:wsc(address,line)))


